<template>
	<view class="goods-list">
		<goods-list @goodsItemClick="goDetail" :goods="goods"></goods-list>

		<view class="isover">--- 没有了 ---</view>
	</view>
</template>

<script>
	import goodsList from "../../components/goods-list/goods-list.vue"
	import {getGoodsList} from '@/api/api.js';
	export default {
		data() {
			return {
				page:1,
				goods:[],
                cate:0
			}
		},
		components:{"goods-list":goodsList},
		onLoad(options){
            this.cate = options.id;
			this.getList()
		},
		methods: {
			async getList (){

				var data = {
					id: this.id,
				}
				await getGoodsList(data).then((res) => {
					this.goods = res.data
				}).catch(() => {

				})

			},
			goDetail(id){
				console.log(id)
				uni.navigateTo({
					url:'/pages/goods-detail/goods-detail?id='+id
				})
			}
		}

	}
</script>

<style lang="scss">
	.goods-list{
		background-color: #eee;
	}
	.isover{
		width: 100%;
		height:50px;
		line-height:50px;
		text-align: center;
		color:#999;
	}
</style>